package org.example.tialsproject.exception;

import org.example.tialsproject.pojo.ResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/*
 *全局异常处理器
 * */
@RestControllerAdvice
public class GlobalException {
    // 指定捕获所有异常
    @ExceptionHandler(Exception.class)
    public ResponseResult exception(Exception e) {
        e.printStackTrace();
        return ResponseResult.error(e.getMessage());
    }
}
